package com.company.card_service.serviceImpl;

import com.company.card_service.model.EmployeeProfiles;
import com.company.card_service.mapper.EmployeeProfilesMapper;
import com.company.card_service.service.EmployeeProfilesService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.company.card_service.util.AliOssCloudUtil1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.Date;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 赵志浩
 * @since 2022-09-15 04:18:37
 */
@Service
public class EmployeeProfilesServiceImpl extends ServiceImpl<EmployeeProfilesMapper, EmployeeProfiles> implements EmployeeProfilesService {


    @Autowired
    private AliOssCloudUtil1 aliOssCloudUtil1;



    @Override
    public boolean saveAll(MultipartFile files, EmployeeProfiles e) {
        String s = aliOssCloudUtil1.uploadFile(files);
        e.setUrl(s);
        if(e.getId() != null){
            e.setUpdateTime(new Date());
            this.baseMapper.updateById(e);
        }else {
            e.setCreateTime(new Date());
            this.baseMapper.insert(e);
        }
        return false;
    }
}
